const checkDetectionId = (res) => {
	
	return new Promise(function(resolve, reject) {
		console.log('查询订单是否可以检测', res)
		// 查询订单是否可以检测
		uni.request({
			url: 'https://lyk.10pay.cn/api/cebei/check_order',
			method: 'POST',
			header: {
				'token': uni.getStorageSync('hz_token')
			},
			data: {
				detection_id: res.detection_id
			},
			success(res) {
				let result = res.data
				console.log(result)
				if (result.code == 1) {
					resolve({
						code: 200,
						message: "查询成功",
						valid: true
					})
				} else {
					reject({
						code: 400,
						message: result.msg,
					})
				}
			},
			complete() {
				
			}
		})
		
	})
}
const getDetectionReport = (res) => {
	var that = this
	console.log('检测结果', res)
	return new Promise(function(resolve, reject) {
		uni.request({
			url: 'https://lyk.10pay.cn/api/cebei/result_data',
			method: 'POST',
			header: {
				'token': uni.getStorageSync('hz_token')
			},
			data: {
				jsonddata: JSON.stringify(res)
			},
			success(res) {
				let result = res.data
				console.log(result)
				if (result.code == 1) {
					resolve({
						code: 200,
						message: "接收成功",
						url: '/pages/checkorder/clinicorder'
					})
				} else {
					reject({
						code: 400,
						message: result.msg,
					})
				}
			},
			complete() {
				uni.hideLoading()
			}
		})

	})
}
module.exports = {
	checkDetectionId: checkDetectionId,
	getDetectionReport: getDetectionReport
}